Web page performance may be improved by applying a set of content transformations, called filters or rewriters, to web pages and/or web page resources. These filters may be provided to customers, and the customers may choose a set of filters to apply to improve the performance of their pages. It may be desirable to automatically determine the filters that should be applied to a webpage and to apply the filters without requiring users, who in many instances do not have sufficient knowledge or expertise, to take part in the filter selection process. However, when filters are automatically applied, some filters may break the functionality of certain web pages due to specific characteristics of the page. An example of this is the defer_javascript filter, which delays execution of Javascript until the page has loaded. If javascript execution is delayed, a document.write( ) call, which writes to the current end of the page, could end up writing content to a different region than intended. Thus, it is necessary to validate the transformation of a page and to find a set of filters that would not break the page when applied to the page.